<template>
  <div>
    <Header />
    <router-view></router-view>
    <!-- <Footer v-if="footerIsShow" /> -->

    <!-- 方法二：通过路由元信息控制footer组件的显示与隐藏 -->
    <Footer v-if="!$route.meta.isHidden" />
  </div>
</template>

<script>
import Header from "@comp/Header";
import Footer from "@comp/Footer";
import { mapActions } from "vuex";
export default {
  name: "App",
  components: {
    Header,
    Footer,
  },
  computed: {
    //方法一： 通过计算属性，来控制footer组件的显示与隐藏
    /* footerIsShow() {
      return this.$route.name !== "login" && this.$route.name !== "register";
    }, */
  },
  mounted() {
    // console.log(this,"this");
    this.getCategoryListAsync();
  },
  methods: {
    // 调用vuex中获取三级分类列表的actions
    ...mapActions("category", ["getCategoryListAsync"]),
  },
};
</script>

<style  scoped lang="less">
</style>